package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.AssesRuleArtificial;
import com.ruoyi.system.service.IAssesRuleArtificialService;
import com.ruoyi.system.service.IAssesRuleArtificialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 人工考核规则Controller
 *
 * @author ruoyi
 * @date 2024-04-22
 */
@RestController
@RequestMapping("/system/assesRule/artificial")
public class AssesRuleArtificialController extends BaseController
{
    @Autowired
    private IAssesRuleArtificialService assesRuleArtificialService;

    /**
     * 查询人工考核规则列表
     */
    @PreAuthorize("@ss.hasPermi('system:artificial:list')")
    @PostMapping("/list")
    public AjaxResult list(@RequestBody AssesRuleArtificial assesRuleArtificial)
    {
        List<AssesRuleArtificial> list = assesRuleArtificialService.selectAssesRuleArtificialList(assesRuleArtificial);
        return success(list);
    }

//    /**
//     * 获取人工考核规则详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:artificial:query')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id)
//    {
//        return success(AssesRuleArtificialService.selectAssesRuleArtificialById(id));
//    }

    /**
     * 新增人工考核规则
     */
    @PreAuthorize("@ss.hasPermi('system:artificial:add')")
    @Log(title = "人工考核规则", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody AssesRuleArtificial assesRuleArtificial)
    {
        return toAjax(assesRuleArtificialService.insertAssesRuleArtificial(assesRuleArtificial));
    }

    /**
     * 修改人工考核规则
     */
    @PreAuthorize("@ss.hasPermi('system:artificial:edit')")
    @Log(title = "人工考核规则", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody AssesRuleArtificial assesRuleArtificial)
    {
        return toAjax(assesRuleArtificialService.updateAssesRuleArtificial(assesRuleArtificial));
    }

    /**
     * 删除人工考核规则
     */
    @PreAuthorize("@ss.hasPermi('system:artificial:remove')")
    @Log(title = "人工考核规则", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(assesRuleArtificialService.deleteAssesRuleArtificialById(id));
    }
}
